# 基础镜像
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openjdk:17-jdk-alpine
# 作者
LABEL maintainer="albert"
# 版本
LABEL version="1.0"
# 描述
LABEL description="wy_agent docker image"

# 工作目录
WORKDIR /docker/www/html/wy_agent

# 设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 暴露端口
EXPOSE 8083

# 复制jar包到工作目录
ARG JAR_FILE
COPY ${JAR_FILE} ./wy_agent.jar

# 设置ENTRYPOINT
ENTRYPOINT ["java", "-Xms256m", "-Xmx512m", "-Dspring.config.location=/docker/www/html/wy_agent/application.yml", "-jar", "/docker/www/html/wy_agent/wy_agent.jar"]

HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
  CMD wget --no-verbose --spider http://localhost:8083/portal/health || exit 1
